package com.netease.string;

import java.util.regex.Pattern;

import org.apache.commons.lang.StringUtils;

public class RegularExpressionUtils {
	
	static boolean isEmail(String email){
		if(!StringUtils.isBlank(email)){
			Pattern emailPattern = Pattern.compile("^\\s*\\w+(?:\\.{0,1}[\\w-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*\\.[a-zA-Z]+\\s*$");
			return emailPattern.matcher(email).matches();
		}		
		return false;
	}
	
	
	public static void main(String[] args) {
		String emailString = "suyisong@qq .com";
		if(isEmail(emailString)){
			System.out.println(emailString+" is a email address.");
		}
		else{
			System.out.println(emailString+" is not a email address.");
		}
	}
}
